<!--作者：靳晓璐-->


<template>
  <div>
    <Leftbar>
    </Leftbar>
    <headers_copy>

    </headers_copy>
    <el-table  class="blog"
               :data="tableData"
               style="width: 100%">

      <el-table-column
          label="博客名称"
          width="550">
        <template slot-scope="props">
          <el-popover trigger="hover" placement="top">
            <p>博客名称: <span content="name">
            {{props.row.title}}
          </span></p>
            <div slot="reference" class="name-wrapper">
              <el-button type="text"><span content="name">
            {{props.row.title}}
          </span></el-button>
            </div>
          </el-popover>
        </template>
      </el-table-column>
      <el-table-column  label="操作" >
        <template slot-scope="scope">
          <el-button-group>
            <el-button type="primary"plain icon="el-icon-edit"></el-button>
            <el-button type="primary"plain icon="el-icon-delete" @click="DeleteArticle(scope.row.aid)"></el-button>
          </el-button-group>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import Leftbar from "../components/Leftbar";
import headers_copy from "@/components/headers_copy";
const axios = require('axios');
export default {
  name:"NewBlog",
  components: {
    Leftbar,
    headers_copy
  },
  data() {
    return {
      tableData: [],
      uid: sessionStorage.getItem("uid"),
    }
  },
  created() {
    const _this=this
    axios.get("http://47.107.40.143:8080/getSpecArticle",{params:{uid:this.uid,state:0}}).then(res =>{
      _this.tableData=res.data.data

      console.log(res)
    })
  },
  methods: {
    handleEdit(index, row) {
      console.log(index, row);
    },
    handleDelete(index, row) {
      console.log(index, row);
    },
    DeleteArticle(aid){
      axios.get("http://47.107.40.143:8080/deleteArticle",{params:{aid:aid}}).then(res=>{
        console.log(res)
        window.location.reload()
      })
    }
  }
}
</script>

<style scoped>
.blog{
  margin-left: 250px;
  margin-top: 15px;
}
</style>
